home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Graphics / StereoScope / Source / SterOptikonApp.m < prev    next >
Text File  |  1994-04-01  |  2KB  |  67 lines

  1. /*
  2.  * This subclass only adds a few responsibilities to the Application class.
  3.  * It loads the info and preferences panels on demand, keeps track of the 
  4.  * path to the app wrapper, and overrides sendEvent: to watch for 
  5.  * control-mouseDown events which it vectors off to the help object.
  6.  *
  7.  * Author: Julie Zelenski, NeXT Developer Support
  8.  * You may freely copy, distribute and reuse the code in this example.  
  9.  * NeXT disclaims any warranty of any kind, expressed or implied, as to 
  10.  * its fitness for any particular use.
  11.  */
  12.  
  13.  
  14. #import "SterOptikonApp.h"
  15. #import "Help.h"
  16. #import <appkit/View.h>
  17. #import <strings.h>
  18. #import <defaults/defaults.h>      // for NXArgv
  19. #import <libc.h>        // for chdir, getwd
  20.  
  21.  
  22. @implementation SterOptikonApp:Application
  23.  
  24. + new;
  25. /* New is overridden so the SterOptikonApp gets and saves the path to executable.
  26.  * The help object will ask the app for this, so it can find the help
  27.  * files which are in a directory in the app wrapper. 
  28.  */
  29. {
  30.     char *suffix;
  31.     
  32.     self = [super new];
  33.     strcpy(appDirectory, NXArgv[0]);
  34.     if (suffix = rindex(appDirectory,'/')) 
  35.         *suffix  = '\0';     /* remove executable name */
  36.     if (appDirectory) chdir(appDirectory); 
  37.     getwd(appDirectory);
  38.     strcpy(openFileName,"");
  39.     return self;
  40. }
  41.  
  42. - (const char *)appDirectory;
  43. /* Returns the path to the app wrapper (for Help object).
  44.  */
  45. {
  46.     return appDirectory;
  47. }
  48.  
  49. - (BOOL)appAcceptsAnotherFile:sender
  50. {
  51.     return YES;
  52. }
  53.  
  54. - (int)openFile:(const char *)filename ok:(int *)flag
  55. {
  56.         strcpy(openFileName,filename);
  57.         *flag = YES;
  58.         return 0;
  59. }
  60.  
  61.  - (char *)getInitialFile;
  62. {
  63.     return (char *)openFileName;
  64. }
  65.  
  66. @end
  67.